﻿using System;
using System.Collections.Generic;

namespace Najak.Editor.Actions
{
	public class EditTileAction : EditorAction
	{
		public Tile Tile;
        public string OldDef;
        public string NewDef;

		public EditTileAction(Tile tile, string newDef)
		{
			Tile = tile;
            NewDef = newDef;
		}

		protected override bool OnApply(Scene scene)
		{
            OldDef = Tile.SetDefinition(NewDef);
				return true;
		}

		protected override void OnUndo(Scene scene)
		{
            string newDef = Tile.SetDefinition(OldDef);

            if (newDef != NewDef)
            {	// error, unexpected
                System.Windows.Forms.MessageBox.Show("OOps, fucker, NewDef is not equal to newDef!");
            }
        }
	}
}
